#!/bin/bash

# 安装firewalld
if ! command -v firewalld >/dev/null 2>&1; then
    if command -v yum >/dev/null 2>&1; then
        yum install -y firewalld
    elif command -v apt-get >/dev/null 2>&1; then
        apt-get install -y firewalld
    elif command -v dnf >/dev/null 2>&1; then
        dnf install -y firewalld
    else
        echo "无法安装 firewalld 服务"
        exit 1
    fi
fi

# 启用并启动firewalld服务
systemctl enable --now firewalld

echo "firewalld配置完成"

